package com.kid.common.valid;

import javax.validation.Constraint;
import javax.validation.Payload;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;

import static java.lang.annotation.RetentionPolicy.RUNTIME;

/**
 * 参考@NotNull注解
 * @Constraint(validatedBy = {EnumConstraintValidator.class})自定义注解和哪个校验器相关联
 * 一个自定义注解，可以和多个校验器组合校验
 */
@Documented
@Constraint(validatedBy = {EnumConstraintValidator.class})
@Target({ElementType.METHOD, ElementType.FIELD, ElementType.ANNOTATION_TYPE, ElementType.CONSTRUCTOR, ElementType.PARAMETER, ElementType.TYPE_USE})
@Retention(RUNTIME)
public @interface EnumValidate {
    //String regexp();
    String message() default "{com.kid.common.valid.EnumValidate.message}";
    Class<?>[] groups() default {};
    Class<? extends Payload>[] payload() default {};
    int[] values() default {};
}